//
//  RefreshTableFooterView.m
//  tcpoctest
//
//  Created by 123456 on 13-7-24.
//  Copyright (c) 2013年 gump. All rights reserved.
//

#import "RefreshTableFooterView.h"
#import <QuartzCore/QuartzCore.h>

#define TEXT_COLOR	 [UIColor colorWithRed:87.0/255.0 green:108.0/255.0 blue:137.0/255.0 alpha:1.0]
#define ACTIVITY_HEIGHT 30.0f

@implementation RefreshTableFooterView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = CELL_BG_COLOR;

        _textLabel = [[UILabel alloc] initWithFrame:CGRectMake((320 - 80)/2, 2, 80, 40)];
        _textLabel.hidden = NO;
        _textLabel.backgroundColor = [UIColor clearColor];
        _textLabel.textAlignment = UITextAlignmentCenter;
        _textLabel.text = @"加载更多";
        _textLabel.font = [UIFont systemFontOfSize:16.0f];
        _textLabel.textColor = TEXT_COLOR;
        [self addSubview:_textLabel];
        
        //风火轮
        _activityView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
        _activityView.frame = CGRectMake(85, 8, ACTIVITY_HEIGHT, ACTIVITY_HEIGHT);
        [self addSubview:_activityView];
        
    }
    return self;
}


#pragma mark -
#pragma mark ScrollView Methods
-(void)RefreshScrollViewDidScroll:(UIScrollView *)scrollView{
    self.hidden = NO;
}


- (void)RefreshScrollViewDidEndDragging:(UIScrollView *)scrollView{
	_textLabel.text = @"正在加载...";
    [_activityView startAnimating];
}

- (void)RefreshScrollViewDataSourceDidFinishedLoading:(UIScrollView *)scrollView {
    self.hidden = YES;
    [_activityView stopAnimating];
    _textLabel.text = @"加载更多";
}



@end
